#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
/*
 * Copyright © 2014, Finium Sdn Bhd, All Rights Reserved
 * 
 * AbstractJob.java
 * Modification History
 * *************************************************************
 * Date				Author						Comment
 * Oct 11, 2012		Venkaiah Chowdary Koneru	Created
 * *************************************************************
 */
package ${package}.support.scheduling;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.Scheduler;
import org.quartz.StatefulJob;

/**
 * Super class for Mi-Trace scheduler jobs. Every scheduler job must extend this
 * abstract class.
 * 
 * 
 * @author Venkaiah Chowdary Koneru
 */
public abstract class AbstractJob implements StatefulJob
{
    protected static final Log LOG = LogFactory.getLog(AbstractJob.class);

    /**
     * {@inheritDoc}
     * 
     * @see org.quartz.Job${symbol_pound}execute(org.quartz.JobExecutionContext)
     */
    @Override
    public void execute(JobExecutionContext jobExecutionContext)
            throws JobExecutionException
    {
        final Scheduler scheduler = jobExecutionContext.getScheduler();
        final JobDetail jobDetail = jobExecutionContext.getJobDetail();

        jobExecution(scheduler, jobDetail);
    }

    /**
     * @param scheduler
     *            scheduler instance
     * @param jobDetail
     *            current job's data
     * @throws JobExecutionException
     *             in case of any errors
     */
    protected abstract void jobExecution(Scheduler scheduler,
            JobDetail jobDetail) throws JobExecutionException;
}
